package me.jessyan.mvparms.demo.util;

import android.graphics.Color;
import android.os.CountDownTimer;
import android.widget.TextView;

import com.platform.ai.control.R;


/**
 * Created by 52248 on 2018/8/28.
 */

public class SmsCount extends CountDownTimer {
    private TextView autoBtn;
    public SmsCount(TextView autoBtn, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.autoBtn = autoBtn;
    }

    @Override
    public void onFinish() {
        autoBtn.setBackgroundResource(R.drawable.bg_arc_btn_red);
        autoBtn.setTextColor(Color.parseColor("#ffffff"));
        autoBtn.setEnabled(true);
        autoBtn.setText("获取验证码");
    }

    @Override
    public void onTick(long millisUntilFinished) {
        autoBtn.setText("" + millisUntilFinished / 1000 % 60 + "秒");
        autoBtn.setEnabled(false);
    }


}

